import { HTTP } from '../utils/http.js'

class LikeModel extends HTTP {
  // 获取书刊点赞状态
  getClassicLikeStatus(cid, type, success) {
    var params = {
      url: `classic/${type}/${cid}/favor`,
      success: success
    }
    this.request(params)
  }

  getBookLikeStatus(bid, type, success) {
    var params = {
      url: 'book/' + type + '/' + bid + '/favor',
      success: success
    }
    this.request(params)
  }

  // 点赞或取消点赞
  like(like_or_cancel, art_id, type) {
    let url = like_or_cancel === 'cancel' ? 'like/cancel' : 'like'
    this.request({
      url,
      method: "POST",
      data: {art_id, type}
    })
  }


}

export { LikeModel }